<div class="hbox hbox-auto-xs hbox-auto-sm" ng-init="
    app.settings.asideFolded = false;
    app.settings.asideDock = false;
  ">
    <!-- main -->
    <div class="col">
        <!-- main header -->
        <div class="bg-light lter b-b wrapper-md">
            <div class="row">
                <div class="col-sm-6 col-xs-12">
                    <h1 class="m-n font-thin h3 text-black">Shadowsocks管理</h1>
                    <small class="text-muted">Shadowsocks配置文件</small>
                </div>
            </div>
        </div>
        <!-- / main header -->
        <div class="wrapper-md">
            <!-- toaster directive -->
            <toaster-container
                    toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>
            <!-- / toaster directive -->

            <uib-tabset>
                    <div class="panel panel-default" ng-controller="shadowsocksUsersConfigCtrl">
                        <div class="panel-body">
                            <div>
                                <form class="form-inline" role="form">
                                    <div class="form-group">
                                        <button ng-show="pbulicFileList == null || pbulicFileList.length ==0"
                                                type="button" class="btn btn-success" ng-click="addItem()"><span
                                                class="glyphicon glyphicon-plus"></span>新增全局配置文件
                                        </button>

                                        <button
                                                type="button" class="btn btn-success" ng-click="doQuery()"><span
                                                class="glyphicon glyphicon-repeat"></span>查询
                                        </button>
                                    </div>
                                </form>
                            </div>

                            <div style="margin-top: 5px;">
                                <table class="table table-hover table-bordered table-striped">
                                    <thead>
                                    <tr>
                                        <td>文件组名</td>
                                        <td class="col-md-6">配置文件（请在GETWAY_HOST_CONF_FILE中配置）</td>
                                        <td>使用类型</td>
                                        <td>操作</td>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr ng-repeat="item in pbulicFileList">
                                        <td>{{item.fileGroupDO.groupName}}</td>
                                        <td>
                                            <b style="color: #777">{{item.filePath}}</b>
                                            </br>
                                            <b style="color: #286090">{{item.fileName}}</b>
                                            <b class="pull-right">{{item.fileDesc}}</b>
                                        </td>
                                        <td>
                                            <b style="color: #f4ca06"
                                               ng-if="item.useType == 0 || item.useTypeDO == null">all</b>
                                            <b ng-if="item.useType == 10">{{item.useTypeDO.typeName}}</b>
                                            <b ng-if="item.useType == 1">{{item.useTypeDO.typeName}}</b>
                                            <b style="color: #990000" ng-if="item.useType == 2">{{item.useTypeDO.typeName}}</b>
                                            <b style="color: #ec971f" ng-if="item.useType == 3">{{item.useTypeDO.typeName}}</b>
                                            <b ng-if="item.useType == 4">{{item.useType.typeName}}</b>
                                            <b ng-if="item.useType == 5">{{item.useType.typeName}}</b>
                                            <b style="color: #286090" ng-if="item.useType == 6">{{item.useTypeDO.typeName}}</b>
                                            <b style="color: #d9534f" ng-if="item.useType == 7">{{item.useTypeDO.typeName}}</b>
                                            <b style="color: #449d44" ng-if="item.useType == 8">{{item.useTypeDO.typeName}}</b>
                                            <b style="color: #5bc0de" ng-if="item.useType == 9">{{item.useTypeDO.typeName}}</b>
                                            <b style="color: black"
                                               ng-if="item.useType > 9">{{item.useTypeDO.typeName}}</b>
                                        </td>
                                        <td>
                                            <button ng-click="editItem(item)"
                                                    class="btn btn-xs"
                                                    ng-disabled="butEditDisabled"
                                                    style="margin-left: 5px; background-color: #2e6da4; color: white;">
                                                <i class="glyphicon glyphicon-edit"></i>编辑
                                            </button>

                                            <button ng-click="launchItem(item.id)"
                                                    class="btn btn-xs"
                                                    style="margin-left: 5px; background-color: limegreen; color: white;">
                                                <span class="glyphicon glyphicon-search"></span>预览
                                            </button>

                                            <button ng-click="createItem(item.id)"
                                                    class="btn btn-xs"
                                                    ng-disabled="butSaveDisabled"
                                                    style="margin-left: 5px; background-color: #ff8700; color: white;">
                                                <i class="fa fa-spin fa-spinner" ng-show="butSaveSpinDisabled"></i>
                                                <i class="glyphicon glyphicon-save" ng-show="!butSaveSpinDisabled"></i>保存
                                            </button>

                                            <button ng-click="invokeItem(item.id)" ng-show="false"
                                                    class="btn btn-xs"
                                                    ng-disabled="butInvokeDisabled"
                                                    uib-popover-html="'同步配置并生效'" popover-trigger="'mouseenter'"
                                                    style="margin-left: 5px; background-color: #ff5f87; color: white;">
                                                <i class="fa fa-spin fa-spinner" ng-show="butInvokeSpinDisabled"></i>
                                                <i class="icon icon-control-play" ng-show="!butInvokeSpinDisabled"></i>执行
                                            </button>

                                            <button ng-click="delItem(item.id)"
                                                    class="btn btn-xs pull-right"
                                                    ng-disabled="butDelDisabled"
                                                    style="background-color: red; color: white;">
                                                <i class="glyphicon glyphicon-remove"></i>删除
                                            </button>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
            </uib-tabset>
        </div>
    </div>
    <!-- / main -->
</div>

<script type="text/ng-template" id="configFile">
    <div ng-include="'tpl/modal/configFile/shadowsocks_config_file_modal.html'"></div>
</script>


<!--查看文件内容-->
<script type="text/ng-template" id="configFileInfo">
    <div ng-include="'tpl/modal/configFile/config_file_info_modal.html'"></div>
</script>